import 'dart:convert';
import 'dart:io';

var f1 = File("/data/data/com.example.game_11_sleep_game11/rank_file");

void save_rank_file(String game_name, int time_count, bool win_flag) {
  var dic = read_rank_file();
  dic.addAll({
    game_name: [game_name, time_count, win_flag]
  });
  f1.writeAsStringSync(json.encode(dic));
}

Map<String, List<dynamic>> read_rank_file() {
  if (!f1.existsSync()) {
    f1.writeAsStringSync(json.encode({}));
  }
  return Map<String, List<dynamic>>.from(json.decode(f1.readAsStringSync()));
}
